<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:p="http://primefaces.org/ui"
	template="/templates/template.xhtml">


	<ui:define name="body">
		<h:form id="formId" prependId="false">
			<p:fieldset legend="#{grupoBean.qualifiedName}" id="fieldPrincipal">
				<h:panelGrid columns="4" id="panelCadastro" border="1" columnClasses="coluna15,coluna30,coluna20,coluna45"
					width="100%">
					<h:outputLabel value="Descrição:" styleClass="icoObrigatorio" />
					<p:inputText value="#{grupoBean.model.descricao}" requiredMessage="#{grupoBean.requiredMessage}"
						required="true" id="nome" size="50" maxlength="255" />
					<p:message for="nome" />
					<h:outputText value=" " />
				</h:panelGrid>
				<br />
				
				<p:toolbar>
					<p:toolbarGroup align="left">
						<p:commandButton value="Salvar" ajax="true" process="@form" update="@form" action="#{grupoBean.save}" />
						<p:commandButton value="Limpar" immediate="true" ajax="false" action="areaAtuacao.jsf" />
					</p:toolbarGroup>
				</p:toolbar>
				<br />
				<p:dataTable paginatorPosition="bottom" var="lista" id="lista" emptyMessage="#{grupoBean.emptyMessage}" update="lista"
					rowsPerPageTemplate="#{grupoBean.paginacao}" styleClass="coluna100" value="#{grupoBean.lazyDataModel}"
					paginator="true" rows="5" rowStyleClass="#{empty rowIx or rowIx mod 2 ne 0 ? 'linhaImpar' : 'linhaPar'}"
					rowIndexVar="rowIx">

					<p:column headerText="Descrição" sortBy="#{lista.descricao}" filterBy="#{lista.descricao}" style="width:80%;font-size: 12px;">
						<h:outputLabel value="#{lista.descricao}" />
					</p:column>

					<p:column style="width:10%;text-align:center;font-size: 12px;">
						<f:facet name="header">
							<h:outputLabel value="Ações" />
						</f:facet>
						<p:commandLink title="Editar" style="padding:5px !important;" update=":formId:panelCadastro" process="@this"
							action="#{grupoBean.load}">
							<h:graphicImage library="design/imagem" name="icone-editar.png" />
							<f:setPropertyActionListener target="#{grupoBean.model}" value="#{lista}" />
						</p:commandLink>
						<p:commandLink title="Excluir" process="@this" oncomplete="confirmation.show()">
							<h:graphicImage library="design/imagem" name="icone-excluir.png" />
							<f:setPropertyActionListener target="#{grupoBean.model}" value="#{lista}" />
						</p:commandLink>
					</p:column>
				</p:dataTable>
			</p:fieldset>
			<p:confirmDialog appendToBody="true" message="Confirma a Exclusão" header="Exclusão" severity="alert"
				widgetVar="confirmation">
				<h:panelGrid columns="2">
					<p:commandButton value="Sim" update="lista" oncomplete="confirmation.hide()"
						actionListener="#{grupoBean.delete}" immediate="true" />
					<p:commandButton value="Não" onclick="confirmation.hide()" />
				</h:panelGrid>
			</p:confirmDialog>
		</h:form>
	</ui:define>
</ui:composition>